<?php 
if(isset($_POST["act"]))
{	
	$noidung = stripslashes($_POST['noidung']);
	$ghichu=$_POST["ghichu"];
	$id_rv=$_POST["id_rv"];
	$sql4="UPDATE tintuc SET noidung='$noidung',ghichu='$ghichu' WHERE id_tintuc='$id_rv'";
	$kq4=mysql_query($sql4);
	if(!$kq4)
		echo "<script>alert('Có lỗi trong quá trình xử lý dữ liệu!');window.history.go(-1);</script>";
	else{				
			 $n4=mysql_affected_rows();
			 echo "<script>alert('Đã sửa');window.history.go(-2);</script>";	
		}		
}

?>

<?php
	function Getghichu($id)
	{
		$sql2 = "SELECT * from tintuc where id_tintuc=$id";
		$kq2 = mysql_query($sql2);
		$s2="";
		$n2=mysql_num_rows($kq2);
		if($n2>0){
		while($r2=mysql_fetch_array($kq2))
		{
			if($r2["ghichu"]=="hienthi"){
				$s2.="<option value='hienthi' selected>";			
				$s2.="Hiển thị";				
				$s2.="<option value='khonghienthi'>";
				$s2.="Không hiển thị";
				$s2.="</option>";
			}
			else{
				$s2.="<option value='hienthi'>";			
				$s2.="Hiển thị";				
				$s2.="<option value='khonghienthi' selected>";
				$s2.="Không hiển thị";	
				$s2.="</option>";
			}

		}
		}
		return $s2;
		
	}	
?>
<?php
include("fckeditor/fckeditor.php") ;
?>
<?php
	$id=$_GET["id_tintuc"];
	$sql="select * from tintuc where id_tintuc='$id'";
	echo $sql;
	$kq=mysql_query($sql);
	$n=mysql_num_rows($kq);
	if($n==0)
	{
		echo "No data";
	}
	else 
	{
		$r=mysql_fetch_array($kq);
		$id_tintuc=$r["id_tintuc"];
		$noidung=$r["noidung"];$ghichu=$r["ghichu"];
?>
<table width="960" height="70" border="0" cellspacing="0" cellpadding="0" bgcolor="#fbfbfb" bordercolordark="#FFFFFF">
	  <tr>
      	<td style="padding:1px solid #CCCCC">
        <div align="left" style="color:#0B55C4; font-family:Tahoma; font-size: 16px; font-weight:bold; padding-left:20px">BẤT ĐỘNG SẢN 	 
      	</div></td>      	
  </tr>
</table>
<table width="960" border="0" cellspacing="0" cellpadding="0">
<form method="post" onsubmit="return bds_insert(ghichu.value)">
  <tr>
    <td colspan="2" class="tieude" align="center">SỬA NỘI DUNG RAO VẶT BẤT ĐỘNG SẢN</td>
  </tr>    
  <tr bgcolor="#FFFFFF">
    <td style="padding-left:80px" height="30" colspan="2">Nội dung: </td>   
  </tr>
  <tr>
  	<td colspan="2" align="center">
    <?php		
	$oFCKeditor = new FCKeditor('noidung') ;
	$sValue = stripslashes($r['noidung']) ;
	$oFCKeditor->BasePath = '../admincp/fckeditor/' ;
	$oFCKeditor->Value = $sValue ;
	$oFCKeditor->Create() ;	
	?>
    </td>
  </tr>  
  <tr>
    <td style="padding-left:80px" height="30" width="110">Ghi chú:</td>
    <td align="left">   
    <select name="ghichu" style="width:240x">
   <?php echo Getghichu($id_tintuc); ?>
    </select>
    </td>
  </tr>  
  <tr>
  	<td class="ketthuc" colspan="2" height="35">
    <input name="" type="submit" value="Update" class="button" onmouseover="style.background='url(../images/button-2-o.gif)'" onmouseout="style.background='url(../images/button-o.gif)'">
        <input name="" type="reset" value="Reset" class="button" onmouseover="style.background='url(../images/button-2-o.gif)'" onmouseout="style.background='url(../images/button-o.gif)'">  
    </td>
  </tr>
  <input type="hidden" name="id_rv" value="<?php echo "$id_tintuc"; ?>" />
  <input type="hidden" name="act">  
  </form>
</table>

<?php 
	}
?>